﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace CartoonViewer
{
    class ControlHelper
    {
        public static void HideControl(FrameworkElement c)
        {
            SetControlVisibility(c, Visibility.Hidden);
        }

        public static void ShowControl(FrameworkElement c)
        {
            SetControlVisibility(c, Visibility.Visible);
        }

        public static void SetControlVisibility(FrameworkElement c, Visibility v)
        {
            c.Dispatcher.Invoke(new Action(() =>
            {
                c.Visibility = v;
            }));
        }

        public static void SetValue(Control c, Action a)
        {
            c.Dispatcher.Invoke(a);
        }

        public static void SetValue(FrameworkElement c, Action a)
        {
            c.Dispatcher.Invoke(a);
        }
    }
}
